#ifndef __check_package_H__
#define __check_package_H__

#include <unistd.h>  //unix std
#include <errno.h> //errno
#include <stdint.h> //uintXX_t

//open
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

//更新节内容
enum
{
    SECTION_RAW_DATA = 0,
    SECTION_FS_FILE,
    SECTION_COMMAND 
};

typedef struct 
{
    char      sec_desc[32]; //32位节描述
    uint64_t blk_offset;   //刷写偏移
    uint64_t data_size;    //64字节有效数据长义
    uint8_t  md5[16];      //16字节MD5
    uint32_t flag;         //节选项
}SectionHeader;



//验证刷机文件
int check_binary_file(const char* file);

//将二进制刷机文件file刷到目标device设备
int flash_binary(const char* file, const char* device, const char* report_file);


int build_binary(int argc, char* argv[]);

int build_section(const char* source_file, const char* desc, const char* dst_file, uint64_t flash_offt, const char* dst_fs_path = NULL, const char* cmd = NULL, uint64_t source_offset = 0, uint64_t max_source_size = 0);

#endif // __check_package_H__
